package com.wings4.school.student

class Gender {


    String  genderName;
    String description;

    static constraints = {
        description(nullable: true);
    }
    public static void initialize() {
        def insertSql = [
                ["Male","Male"],
                ["Female","Female"]

        ]
        if (Gender.countByGenderName("Male") < 1 && insertSql) {
            insertSql.each {
                Gender gender =null;
                try{
                    gender = new Gender(genderName: it[0], description: it[1]);
                    gender.save(flush: true);
                } catch(Exception e){
                    e.printStackTrace();
                }
            }

        }
    }
}
